package com.olek;

import java.io.File;

import com.olek.Model.ModelFragment;

public class Controller {
	
	private Model model;
	private View view;
	
	public Controller() {
		model = new Model();
		view = new View(model, this);
		
		File[] roots = File.listRoots();
		File[] content = roots[0].listFiles();
		
		model.onFragmentLoad(roots, content, true);
		model.onFragmentLoad(roots, content, false);
		
		view.refresh(true);
		view.refresh(false);
		
	}
	
	public void updateContent(File file, boolean isLeft) {
		ModelFragment fragment = model.getFragment(isLeft);
		fragment.setContent(file.listFiles());
		view.refresh(isLeft);
	}

}

